package sketch.shape.geom.prim;

import sketch.shape.ShapeThreshold;

public class gAngle {

	public double radian;

	public gAngle(double r) {
		radian = r;
	}

	public static double getIdenticalThreshold() {
		return ShapeThreshold.angleIdentical;
	}

	public static double getEqualThreshold() {
		return ShapeThreshold.angleDis;
	}

	public double getRadian() {
		return radian;
	}

	public double getDegree() {
		return radian * 180 / Math.PI;
	}

	public double getRadianPrefix() {
		return radian / Math.PI;
	}

	public gAngle disAbs(gAngle mate) {
		return new gAngle(Math.abs(getRadian() - mate.getRadian()));
	}

	public gAngle dis(gAngle mate) {
		return new gAngle(getRadian() - mate.getRadian());
	}

	public boolean identical(gAngle mate) {
		return disAbs(mate).getRadian() < getIdenticalThreshold();
	}

	public boolean equals(gAngle mate) {
		return disAbs(mate).getRadian() < getEqualThreshold();
	}

	public boolean equals2(gAngle mate) {
		return disAbs(mate).getRadian() < 2 * getEqualThreshold();
	}

	public boolean equals3(gAngle mate) {
		return disAbs(mate).getRadian() < 3 * getEqualThreshold();
	}


}
